<template>
    <div class="left-chart-1">
        <!-- <dv-decoration-2 style="height:10px;" /> -->
        <div class="lc1-chart">
            <line-chart :options="barOptions" style="width: 100%; height: 260px;"></line-chart>
        </div>
    </div>
</template>

<script setup name="servicePlanterBar">
import LineChart from '@/views/dashboard/components/datav/LineChart.vue';
import { listServiceMonthlySummary } from '@/api/statistics/plant_service';
import dayjs from "dayjs";



const currentYear = dayjs().year().toString();



const labelOption = {
    show: true,
    position: 'insideBottom',
    distance: 15,
    align: 'left',
    verticalAlign: 'middle',
    rotate: 90,
    formatter: '{c}  {name|{a}}',
    fontSize: 12,
    rich: {
        name: {}
    }
};



const barOptions = reactive({
    title: {
        text: '月度服务统计'
    },
    legend: {
        textStyle: {
            color: '#fff'
        },
        data: ["农事指导", "日常巡园", "技术培训", "生长期异常"]
    },
    xAxis: [
        {
            type: 'category',
            data: [],
            boundaryGap: false,
            axisPointer: {
                type: 'shadow'
            }
        }
    ],
    yAxis: [{
        type: 'value'
    }],
    series: []
})





function getList() {
    listServiceMonthlySummary({ "year": currentYear }).then(response => {
        barOptions.xAxis[0].data = response.others;
        barOptions.series = response.rows;
    });
}

getList();

</script>

<style lang="scss" scoped>
.left-chart-1 {
    width: 100%;
    height: 220px;
    padding: 20px;
    // display: flex;
    // flex-grow: 0;
    // flex-direction: column;

    .lc1-header {
        text-align: center;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 30px;
        margin-bottom: 20px;
    }

    .lc1-details {
        height: 50px;
        font-size: 16px;
        display: flex;
        align-items: center;
        text-indent: 20px;

        span {
            color: #096dd9;
            font-weight: bold;
            font-size: 35px;
            margin-left: 20px;
        }
    }

    .lc1-chart {
        flex: 1;
    }
}
</style>
